//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================


namespace App.Domain.Handlers {
    using System;
    using App.Data;
    using App.Domain.Contracts;

    public class DeleteJobCategory {
        private readonly IJobCategoryRepository _JobCategoryRepository;

        public DeleteJobCategory(IJobCategoryRepository JobCategoryRepository) {
            _JobCategoryRepository = JobCategoryRepository;
        }

        public virtual void Execute(Guid jobCategoryId) {
            var JobCategoryToDelete = _JobCategoryRepository.GetJobCategory(jobCategoryId);

            if (JobCategoryToDelete != null) {
                _JobCategoryRepository.Delete(jobCategoryId);
            }
            else {
                throw new BusinessServicesException("UnableToDeleteVehicleExceptionMessage");
            }
        }
    }
}
